feat: support pre-uploading files to a session before it starts#1282
feat: support pre-uploading files to a session before it starts#1282jeremyeder merged 4 commits intomainfrom
Conversation
Implementation NotesArchitectureThis PR leverages the existing S3 state-sync architecture. The init container ( New Backend Endpoints
All endpoints perform RBAC checks and path sanitization. The session CR must exist but the pod does not need to be running. Frontend Flow
ConfigurationThe backend reads S3 config from environment variables: 🤖 Session |
Pull Reviews🚨 Concerning — Adds pre-upload file functionality allowing files to be staged in S3 before session startup, with frontend fallback handling, backend routing, S3 storage operations, and test coverage. Callouts
File-by-file breakdown
Generated by pull-reviews — automated video reviews for PRs |
Enable users to attach files during session creation that are uploaded directly to S3/MinIO storage. The session's init container (hydrate.sh) already downloads from this S3 path, so pre-uploaded files are automatically seeded into the workspace when the pod initializes. Backend changes: - Add `storage` package with MinIO/S3 client (upload, list, delete) - Add pre-upload endpoints: PUT/GET/DELETE file-uploads for sessions - S3 config loaded from env vars (S3_ENDPOINT, S3_BUCKET, AWS creds) - RBAC-checked, path-sanitized, works regardless of session pod state Frontend changes: - Add file attachment section to CreateSessionDialog - Upload route falls back to pre-upload endpoint on 409 (not running) - Files uploaded after session creation, before navigation Closes #1280 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Downgrade minio-go from v7.0.100 (requires Go 1.25) to v7.0.82 which is compatible with the Go 1.24.6 used in the Dockerfile - Restore `toolchain go1.24.7` directive in go.mod - Fix gofmt formatting in storage/s3_test.go Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix file permissions (755→644) on go.mod, go.sum, main.go, routes.go - Add backend 10MB size limit (LimitReader + 413 response) to match frontend - Use bytes.NewReader instead of strings.NewReader(string(payload)) - Use errors.IsNotFound() instead of fragile string matching - Check reqDyn != nil alongside reqK8s in all three handlers Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
84a10d5 to
5a63622
Compare
✅ Deploy Preview for cheerful-kitten-f556a0 canceled.
|
|
| File | Component | Mode |
|---|---|---|
components/frontend/src/components/create-session-dialog.tsx |
runner | warn |
No action required — these components are in warn mode. Consider using the component's agent workflow for future changes.
📖 Specs: Runner Spec · Runner Constitution
jeremyeder
left a comment
There was a problem hiding this comment.
Code reviewed and hardened: fixed file permissions, added backend size limit, bytes.NewReader, errors.IsNotFound, reqDyn nil checks. Rebased on current main. All tests pass.
## Summary - Add `DropdownMenuSeparator` to the `+` dropdown, dividing context actions (Add Repository, Upload File) from session options - Add discovery dot on the `+` button — highlights new menu items using `useLocalStorage` hook with version tracking - Establishes the extensible pattern for per-session configuration: boolean toggles as `DropdownMenuCheckboxItem`, form-heavy config as `DropdownMenuItem` → `Dialog` This PR adds no new session options — it creates the infrastructure that PR #1326 (SDK Options) and PR #1328 (Project Intelligence) will build on. ## Menu Pattern ``` [+] button (discovery dot when new items exist) ├── Add Repository → existing modal ├── Upload File → existing (PR #1282) ├── DropdownMenuSeparator └── (future items: toggles inline, forms via modal) ``` ## Test plan - [x] Frontend test suite: 631 passed, 0 failed - [x] Frontend build: 0 errors, 0 warnings - [x] CodeRabbit CLI: 0 major/critical findings - [x] Discovery dot: uses existing `useLocalStorage` hook (SSR-safe, cross-tab sync) 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Release Notes * **New Features** * Added a visual separator in the session options dropdown menu for improved organization. * Introduced a discovery indicator dot on the "+" button to highlight menu updates. * The indicator dot automatically clears upon opening the dropdown menu. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Ambient Code Bot <bot@ambient-code.local> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
/file-uploads/) that write files directly to MinIO/S3, bypassing the runnerhydrate.sh) already downloads from the same S3 path, so pre-uploaded files are automatically seeded into the workspaceCloses #1280
Test plan
cd components/backend && go build ./...cd components/backend && go test ./storage/ -vcd components/backend && go test -run TestFileUpload ./handlers/ -vcd components/frontend && npm run buildcd components/frontend && npx vitest run create-session-dialog-filescd components/frontend && npx vitest run upload-file-modal/workspace/file-uploads/after pod starts🤖 Ambient Session